package com.lhyl.front.web.shiro.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.lhyl.front.common.MD5Util;
import com.lhyl.front.web.shiro.model.User;

/**
 * 
 * PasswordHelper.java
 * <p>Copyright: Copyright (c) 2015 <p> 
 * <p>Company: daoyi</p>
 *  @author    xiaohui
 *  @version   1.0
 */
@Component
public class PasswordHelper
{

    @Value("${password.algorithmName}")
    private String algorithmName = "md5";

    @Value("${password.hashIterations}")
    private int hashIterations = 1;

    public void setAlgorithmName(String algorithmName)
    {
        this.algorithmName = algorithmName;
    }

    public void setHashIterations(int hashIterations)
    {
        this.hashIterations = hashIterations;
    }

    /**
     * 密码不加盐加密
     * @param user 用户对象
     */
    public String encryptPassword(String passWord)
    {
        return MD5Util.MD5(passWord);
    }
}
